﻿
Global.OuSuisJeService = {

   aasService:'OuSuisJeService',
   aasPublished:true,
      
   Reload: function () {

        var idx = location.href.indexOf('?');
        var loc = location.href.substring(0, idx);
        location.href = loc;

   },

   Initialize: function(dataSet) {

        var currentUser = Aspectize.ExecutingContext.GetCurrentUser();

        if (currentUser.IsAuthenticated) {

            Aspectize.Host.ExecuteCommand('UIService.ShowView', 'Home');
            Aspectize.Host.ExecuteCommand('UIService.ShowView', 'LoginViewLoggedIn');
        }
    },

    AfterLogin: function(dataSet, loginControlId) {

        var currentUser = Aspectize.ExecutingContext.GetCurrentUser();

        if (!currentUser.IsAuthenticated) {

            document.getElementById('Login-ErrorMessage').style.visibility = 'visible';

            var passwordBox = loginControlId + '-' + 'Password';
            document.getElementById(passwordBox).value = '';
        }
        else {

            Aspectize.Host.ExecuteCommand('Browser/OuSuisJeService.Initialize', dataSet);
        }
    }

};

